import {request} from './request.js'

export function requestDetail(iid){
    return request({
        url:'/detail',
        params:{
            iid
        }
    })
}
export function requestDetailRecommend(){
    return request({
        url:'recommend'    
    })
}

//封装好的物品信息类
export class GoodsInfo{
    constructor(itemInfo,columns,services){
        this.title = itemInfo.title
        this.desc = itemInfo.desc
        this.oldPrice = itemInfo.oldPrice
        this.price = itemInfo.price
        this.discountDesc = itemInfo.discountDesc
        this.columns = columns
        this.lowNowPrice = itemInfo.lowNowPrice
        this.services = services
    }
}

export class ShopInfo{
    constructor(shopInfo){
        this.logo = shopInfo.shopLogo
        this.name = shopInfo.name
        this.fans = shopInfo.cFans
        this.sells = shopInfo.cSells
        this.score = shopInfo.score
        this.cGoods = shopInfo.cGoods
    }
}

export class DetailGoods{
    constructor(DetailInfo){
        this.desc = DetailInfo.desc
        this.key = DetailInfo.detailImage[0].key
        this.imgList = DetailInfo.detailImage[0].list
    }
}

export class GoodsParam{
    constructor(info,rule){
        this.image = info.images ? info.images[0] : ""
        this.infos = info.set
        this.sizes = rule.tables
    }
}